#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include "app.hpp"

//#include "MySqlDataModel.h"
#include "customsqldatasource.h"
//#include "SongsVNSqlData.h"
//#include "SongsENSqlData.h"

using namespace bb::cascades;
using namespace bb::data;

App::App() {
	DataSource::registerQmlTypes();
	//qmlRegisterType<MySqlDataModel>("custom",1,0,"MySqlDataModel");
	// Register the SQL data source, so that it can be set up in QML
	qmlRegisterType < CustomSqlDataSource > ("com.songs.data", 1, 0, "CustomSqlDataSource");
	//qmlRegisterType <SongsVNSqlData> ("com.songs.data", 1, 0, "SongsVNSqlData");
	//qmlRegisterType <SongsENSqlData> ("com.songs.data", 1, 0, "SongsENSqlData");
	QmlDocument *qml = QmlDocument::create("asset:///main.qml");
	qml->setContextProperty("cs", this);

	AbstractPane *root = qml->createRootObject<AbstractPane>();
	Application::instance()->setScene(root);
}
